<?php

function abwesenheit_anlegen ($user,$start,$end,$reason,$dateAdded)
{
	// $cHquery="SELECT id FROM combinations WHERE teamId=",$homeU;
	// $cHe = mysql_query($cHquery);
	// $homeC = (mysql_fetch_object($cHe))->id;
	
	// $cGquery="SELECT id FROM combinations WHERE teamId=",$guestU;
	// $cGe = mysql_query($cGquery);
	// $guestC = (mysql_fetch_object($cGe))->id;
	include("inc_configuration.php");
	
	
	$aQuery = "INSERT INTO $tbl_abwesenheit (userId,start,end,reason,dateAdded) 
				VALUES ($user,$start,$end,'$reason',$dateAdded)";
	$anlegen = mysql_query($aQuery);
	return ($aQuery);
}


function is_abwesend ($user)
{
	// $cHquery="SELECT id FROM combinations WHERE teamId=",$homeU;
	// $cHe = mysql_query($cHquery);
	// $homeC = (mysql_fetch_object($cHe))->id;
	
	// $cGquery="SELECT id FROM combinations WHERE teamId=",$guestU;
	// $cGe = mysql_query($cGquery);
	// $guestC = (mysql_fetch_object($cGe))->id;
	include("inc_configuration.php");
	
	$time=time();
	
	$aQuery = "SELECT * FROM $tbl_abwesenheit WHERE userId=$user AND start<$time AND end>$time";
	$anlegen = mysql_query($aQuery);
	$qc = mysql_num_rows($anlegen);
	
	if ($qc>0)
	{
		return true;
	}
	else
	{
		return false;
	}
}




?>